package
{
	/**
	 *
	 *@author CrazyChen 
	 *2013-4-8
	 */	
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.geom.Point;
	
	public class BackgroundView extends Sprite
	{
		[Embed(source="resource/地图/路点.png")]
		private var LineNode:Class;
		
		[Embed(source="resource/地图/背景.png")]
		private var bg:Class;
		
		private var wall:ShanghaiWall;
		
		private var shanghaiWall:ShanghaiWall;
		
		public function BackgroundView()
		{
			super();
			this.mouseChildren = false;
			this.mouseEnabled = false;
		}
		
		public function initface():void{
		    this.addChild(new bg());
			initWall();
		}
		
		/**
		 * 初始化城墙
		 */
		private function initWall():void
		{
			if(!shanghaiWall)shanghaiWall = new ShanghaiWall();
			initNode();
			this.addChild(shanghaiWall);
			shanghaiWall.refreshView(); 
		}
		
		private function initNode():void{
			var i:int=0;
			var point:Point;
			var line:Array = TowerWarMap.instance.gradMap.line;
			for(i;i<line.length;i++){
				point = line[i];
				var bmp:Bitmap = new LineNode();
				this.addChild(bmp);
				bmp.x = point.x - GradMap.GRAD_WIDTH/2;
				bmp.y = point.y - GradMap.GRAD_HEIGTH/2;
			}
		}
		
	}
}